﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="/HR_SYSTEM/Styles/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/HR_SYSTEM/Styles/admin-all.css" />
    <script type="text/javascript" src="/HR_SYSTEM/Scripts/jquery-1.7.2.js"></script>
    <script type="text/javascript" src="/HR_SYSTEM/Scripts/jquery-ui-1.8.22.custom.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/HR_SYSTEM/Styles/ui-lightness/jquery-ui-1.8.22.custom.css" />
    <script type="text/javascript" src="/HR_SYSTEM/Scripts/tip.js"></script>
    <script type="text/javascript">
    	function editRole(){
    		document.forms["form_add"].submit();
    	}
    </script>
</head>
<body>
    <div></div>
    <div class="alert alert-info">当前位置<b class="tip"></b>管理界面<b class="tip"></b>修改角色</div>
    <form action="<c:url value='/RoleServlet'/>" name="form_add" method="post">
     <input type="hidden" name="method" value="updateRole"/>
     <table class="table table-striped table-bordered table-condensed">
        <tr>
        	<td>角色编码:</td>
            <td>${role_find.role_ID}</td>
            <input type="hidden" name="role_id" value="${role_find.role_ID}"/>
        </tr>
        <tr>
        	<td>角色名称:</td>
            <td>${role_find.role_Name}</td>
            <input type="hidden" name="role_name" value="${role_find.role_Name}"/>
        </tr>
         <c:forEach items="${privileges_find}" var="privilege_find">
        	<tr>
        		<c:if test="${not empty privilege_find.functions}">
        			<td>已经安排的权限<font color="red">${privilege_find.privilege_name}</font>:</td>
        			<c:set value="${privilege_find.role_id}" var="r_id"></c:set>
        			<td>
        				【
        				<c:forEach items="${privilege_find.functions}" var="function">
        				<c:if test="${r_id eq function.role_id}">
        					<font color="blue">${function.function_name}</font>
        				</c:if>
        				</c:forEach>
        				】
        			</td>
        		</c:if>
        	</tr>
        </c:forEach>
 	</table>
 	<table class="table table-striped table-bordered table-condensed">
        <tr>
            <td>权限</td>
            <td>功能</td>
        </tr>
        <c:forEach items="${privileges}" var="privilege">
        	<tr>
           		<td>
          			<input type="checkbox" name="privileges" value="${privilege.privilege_id}" >${privilege.privilege_name}     
            	</td>
            	<c:set var="prid" value="${privilege.privilege_id}"></c:set>
            	<td>
            		<c:forEach items="${privilege.functions}" var="function">
            			<input type="checkbox" name="functions" value="${function.function_id},${prid}">${function.function_name}
            		</c:forEach>
            	</td>
            	</tr>
        </c:forEach>
    	 <tr>
            <td colspan="2">
                <input class="btn btn-inverse" id="button" type="button" onClick="editRole()" value="修改角色信息" />&nbsp;
                <input class="btn btn-inverse" type="reset" value="清空" />&nbsp;
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
